home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / cxt220.zip / CXT_ME.CMD < prev    next >
OS/2 REXX Batch file  |  1994-03-20  |  12KB  |  347 lines

  1. ;*****************************************************************************
  2. ;
  3. ;   CXT_ME.CMD - MicroEMACS MACRO FUNCTIONS FOR
  4. ;
  5. ;       CSTN (TM) C STRUCTURE TREE NAVIGATOR
  6. ;       CFTN (TM) C FUNCTION TREE NAVIGATOR
  7. ;
  8. ;   Copyright (C) Juergen Mueller (J.M.) 1992-1994
  9. ;   All rights reserved.
  10. ;
  11. ;   You are expressly prohibited from selling this software in any form,
  12. ;   distributing it with another product, or removing this notice.
  13. ;
  14. ;   Limited permission is given to registered CXT users to modify this
  15. ;   file for their own personal use only. This file may not be used for any
  16. ;   purpose other than in conjunction with the CXT software package.
  17. ;
  18. ;   THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
  19. ;   EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, THE
  20. ;   IMPLIED WARRANTIES OF MERCHANTIBILITY OR FITNESS FOR A PARTICULAR
  21. ;   PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
  22. ;   PROGRAM AND DOCUMENTATION IS WITH YOU.
  23. ;
  24. ;   written by: Juergen Mueller, Aldingerstrasse 22, D-70806 Kornwestheim,
  25. ;               GERMANY
  26. ;
  27. ;   FILE       : CXT_ME.CMD
  28. ;   REVISION   : 16-Mar-1994
  29. ;                20:49:47
  30. ;
  31. ;*****************************************************************************
  32.  
  33. ; NOTE: for OS/2 you should exchange "cftn" with "cftn4os2"
  34. ; NOTE: for OS/2 you should exchange "cstn" with "cstn4os2"
  35. ; NOTE: for NT you should exchange "cftn" with "cftn4nt"
  36. ; NOTE: for NT you should exchange "cstn" with "cstn4nt"
  37.  
  38. ;*****************************************************************************
  39. ;**** write initial message ****
  40. ;*****************************************************************************
  41. write-message "Loading CXT macro package"
  42.  
  43. ;*****************************************************************************
  44. ;**** macro package initialization section ****
  45. ;*****************************************************************************
  46. set %cxt_item ""                ; set internal variables
  47. set %cxt_file ""
  48. set %cxt_line ""
  49. set %cxtn_cmd ""
  50. set %char_set "_$abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
  51.  
  52. set %cft_base &env "CFTNBASE"   ; get environment variables, if set
  53. !if &seq &len %cft_base 0
  54.   set %cft_base &env "CXTNBASE"
  55.  
  56.   !if &seq &len %cft_base 0
  57.     set %cft_base ""
  58.   !endif
  59. !endif
  60.  
  61. set %cst_base &env "CSTNBASE"   ; get environment variables, if set
  62. !if &seq &len %cst_base 0
  63.   set %cst_base &env "CXTNBASE"
  64.  
  65.   !if &seq &len %cst_base 0
  66.     set %cst_base ""
  67.   !endif
  68. !endif
  69.  
  70. ;*****************************************************************************
  71. ;**** definition of user macros ****
  72. ;*****************************************************************************
  73.  
  74. ;**** find function ****
  75. store-procedure cft
  76.         execute-procedure _extract_item         ; get tagged item
  77.         execute-procedure _cxt_cft
  78. !endm
  79.  
  80. ;**** find data type ****
  81. store-procedure cst
  82.         execute-procedure _extract_item         ; get tagged item
  83.         execute-procedure _cxt_cst
  84. !endm
  85.  
  86. ;**** find function ****
  87. store-procedure cftmark
  88.         execute-procedure _extract_marked_item  ; get marked item
  89.         execute-procedure _cxt_cft
  90. !endm
  91.  
  92. ;**** find function ****
  93. store-procedure cstmark
  94.         execute-procedure _extract_marked_item  ; get marked item
  95.         execute-procedure _cxt_cst
  96. !endm
  97.  
  98. ;**** find function ****
  99. store-procedure cftfind
  100.         set %cxt_item "CFT function name: "
  101.         set %cxt_item @%cxt_item                ; get user input
  102.         execute-procedure _cxt_cft
  103. !endm
  104.  
  105. ;**** find data type ****
  106. store-procedure cstfind
  107.         set %cxt_item "CST data type name: "
  108.         set %cxt_item @%cxt_item                ; get user input
  109.         execute-procedure _cxt_cst
  110. !endm
  111.  
  112. ;**** set CFT database name ****
  113. store-procedure cftbase
  114.         set %cft_base "CFT database name: "
  115.         set %cft_base @%cft_base                ; get user input
  116. !endm
  117.  
  118. ;**** set CST database name ****
  119. store-procedure cstbase
  120.         set %cst_base "CST database name: "
  121.         set %cst_base @%cst_base                ; get user input
  122. !endm
  123.  
  124. ;**** set CFT and CST database name ****
  125. store-procedure cxtbase
  126.         set %cxt_base "CFT and CST database name: "
  127.         set %cxt_base @%cxt_base                ; get user input
  128.         set %cft_base %cxt_base
  129.         set %cst_base %cxt_base
  130. !endm
  131.  
  132. ;**** CFT file list
  133. store-procedure cftfile
  134.         write-message "Extracting CFT filelist"
  135.  
  136.         !if ¬ &seq &len %cft_base 0
  137.           set %tmp &cat &cat "-f" %cft_base " "         ; database access path
  138.         !else
  139.           set %tmp ""
  140.         !endif
  141.  
  142.         set %cxtn_cmd &cat "cftn -F " %tmp
  143.         pipe-command %cxtn_cmd          ; perform database access, shell command
  144. !endm
  145.  
  146. ;**** CST file list
  147. store-procedure cstfile
  148.         write-message "Extracting CST filelist"
  149.  
  150.         !if ¬ &seq &len %cst_base 0
  151.           set %tmp &cat &cat "-f" %cst_base " "         ; database access path
  152.         !else
  153.           set %tmp ""
  154.         !endif
  155.  
  156.         set %cxtn_cmd &cat "cstn -F " %tmp
  157.         pipe-command %cxtn_cmd          ; perform database access, shell command
  158. !endm
  159.  
  160. ;*****************************************************************************
  161. ;**** internal macro execution functions ****
  162. ;*****************************************************************************
  163.  
  164. ;*****************************************************************************
  165. ;* CFT front-end *
  166. ;*****************************************************************************
  167. store-procedure _cxt_cft
  168.         !if &seq &len %cxt_item 0
  169.           write-message "No function selected"
  170.           !return
  171.         !endif
  172.  
  173.         write-message &cat &cat "Searching for function: '" %cxt_item "'"
  174.  
  175.         !if ¬ &seq &len %cft_base 0
  176.           set %tmp &cat &cat "-f" %cft_base " "         ; database access path
  177.         !else
  178.           set %tmp ""
  179.         !endif
  180.  
  181.         set %cxtn_cmd &cat &cat "cftn -b " %tmp %cxt_item
  182.         execute-procedure _cxt_search                   ; start search
  183. !endm
  184.  
  185. ;*****************************************************************************
  186. ;* CST front-end *
  187. ;*****************************************************************************
  188. store-procedure _cxt_cst
  189.         !if &seq &len %cxt_item 0
  190.           write-message "No data type selected"
  191.           !return
  192.         !endif
  193.  
  194.         write-message &cat &cat "Searching for data type: '" %cxt_item "'"
  195.  
  196.         !if ¬ &seq &len %cst_base 0
  197.           set %tmp &cat &cat "-f" %cst_base " "         ; database access path
  198.         !else
  199.           set %tmp ""
  200.         !endif
  201.  
  202.         set %cxtn_cmd &cat &cat "cstn -b " %tmp %cxt_item
  203.         execute-procedure _cxt_search                   ; start search
  204. !endm
  205.  
  206. ;*****************************************************************************
  207. ;* the database retrieval function *
  208. ;*****************************************************************************
  209. store-procedure _cxt_search
  210.         set %cxt_file ""                ; clear variables
  211.         set %cxt_line ""
  212.  
  213. !force  pipe-command %cxtn_cmd          ; perform database access, shell command
  214.         !if &seq $status FALSE
  215.           !return
  216.         !endif
  217.  
  218. !force  select-buffer command           ; get result buffer from pipe-command
  219.         !if &seq $status FALSE
  220.           !return
  221.         !endif
  222.  
  223. !force  beginning-of-file               ; go to file begin
  224.         !if &seq $status FALSE
  225.           !return
  226.         !endif
  227.  
  228.         set-mark                        ; extract target file name
  229.  
  230. !force  search-forward " "              ; search for first blank after file name
  231.         !if &seq $status FALSE
  232.           !return
  233.         !endif
  234.  
  235.         backward-character
  236.         copy-region
  237.         set %cxt_file $kill             ; store target file name
  238.         forward-character
  239.         set-mark                        ; extract target file line
  240.         end-of-line
  241.         copy-region
  242.         set %cxt_line $kill             ; store target file line